package com.kg.tombs.entitys;

import io.vertx.core.json.JsonObject;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 墓葬信息
 */
@Data
public class Tomb {

    /**
     * 墓葬ID，唯一标识符
     */
    private Integer tombId;

    /**
     * 墓葬名称
     */
    private String tombName;

    /**
     * 所属时期
     */
    private String period;

    /**
     * 来源信息
     */
    private String source;

    /**
     * 所属区域信息
     */
    private Region region;

    /**
     * 墓葬描述信息
     */
    private String description;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;

    public Tomb(String tombName, String period, String source, Region region, String description, LocalDateTime createdAt, LocalDateTime updatedAt) {
        this.tombName = tombName;
        this.period = period;
        this.source = source;
        this.region = region;
        this.description = description;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
    }

    public JsonObject toJson() {
    	return new JsonObject()
    			.put("tombName", tombName)
    			.put("period", period)
    			.put("source", source)
    			.put("region", region)
    			.put("description", description)
    			.put("createdAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
    			.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
    }

}
